package com.gexiaobao.pigeon.ui.adapter

import androidx.core.content.ContextCompat
import com.chad.library.adapter.base.BaseQuickAdapter
import com.gexiaobao.pigeon.R
import com.gexiaobao.pigeon.app.base.DataBindBaseViewHolder
import com.gexiaobao.pigeon.app.model.bean.PassProjectInfoBean
import com.gexiaobao.pigeon.databinding.ItemSinglePassProjectBinding

/**
 * @Author      : hxw
 * @Date        : 2024/7/22 11:18
 * @Describe    :
 */
class AdapterSinglePassProject(data: ArrayList<PassProjectInfoBean>) :
    BaseQuickAdapter<PassProjectInfoBean, DataBindBaseViewHolder>(R.layout.item_single_pass_project, data) {
    override fun convert(holder: DataBindBaseViewHolder, item: PassProjectInfoBean) {
        val binding = DataBindBaseViewHolder.getBinding(holder) as ItemSinglePassProjectBinding
        binding.data = item
        binding.executePendingBindings()//防止列表抖动

        if (holder.layoutPosition % 2 == 0) {//偶数
            holder.setBackgroundColor(R.id.llItem, ContextCompat.getColor(context, R.color.comm_bg))
        } else {
            holder.setBackgroundColor(R.id.llItem, ContextCompat.getColor(context, R.color.white))
        }

//        holder.setText(R.id.tvItemSinglePassSerialNo, (holder.layoutPosition + 1).toString())
        holder.setGone(R.id.ivArrow, item.ringId.isEmpty())
    }
}